 |
|
 |
Subject: Invalid Form ($BODY is not rich text) |
 |
 |
 |
Product Area: Notes Client |
 |
Technical Area: Application Development |
 |
Platform: Windows |
 |
Release: 8.5.3 |
 |
Reproducible: Always |
 |
 |
 |
 |
We are running 8.5.3 FP2 on the server and client.
I have a custom agent in my mail file to delete attachments from selected documents (see below). When I select a document that has attachments, and call the agent, it is supposed to delete the attachment and add some text at the bottom of the document indicating when the attachment was deleted.
The agent deletes the attachment as expected, but when I open the memo, I see what appears to be the attachment still there.

When I click on it, I get the following error.

Agent Code:
Sub Initialize
Print "Begin: Attachment Deletion"
Dim ns As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim attachmentObject As Notesembeddedobject
Set db = ns.CurrentDatabase
Set dc = db.UnprocessedDocuments
Dim attcount As Variant
Dim attNames As Variant
Dim txt As String
If dc.Count = 0 Then
MessageBox "No document selected",, "Error"
Exit Sub
End If
Set doc = dc.GetFirstDocument
While Not (doc Is Nothing)
attcount = Evaluate(|@Attachments|, doc )
attNames = Evaluate ({@AttachmentNames}, doc)
If attcount(0) > 0 Then
Set rtitem = doc.GetFirstItem("Body")
Call rtitem.AddNewLine( 2 )
ForAll attachment In attNames
Set attachmentObject = doc.GetAttachment(CStr(attachment))
txt$ = "[Attachment '" & CStr(attachment) & "' was deleted by " & ns.CommonUserName & " on " & Today & "]"
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText( txt$ )
Call attachmentObject.Remove
Call doc.Save( False, True )
End ForAll
Else
End If
Set doc=dc.GetNextDocument(doc)
Wend
Print "Completed: Attachment Deletion"
End Sub
Any ideas would be much appreciated.
Thanks,
Dan
 
Feedback number DASS8YYSZW created by ~Dexter Dwojumilyikle on 10/11/2012

Status: Open
Comments:

Invalid Form ($BODY is not rich tex... (~Helga Opwetexl... 11.Oct.12)
. . How are you removing the attachment... (~Ned Nimfanakon... 11.Oct.12)
. . I don't think that's a good way to ... (~Fritz Ekfoober... 12.Oct.12)
. . . . re:I don't think that's a good way ... (~Helga Opwetexl... 12.Oct.12)
. . . . . . Lots of ways suggested in the forum... (~Fritz Ekfoober... 12.Oct.12)
. . . . . . . . Thanks for the technote.. (~Helga Opwetexl... 12.Oct.12)
. . . . Re:How are you removing the attachm... (~Helga Opwetexl... 12.Oct.12)
. . . . . . Solution (~Helga Opwetexl... 15.Oct.12)
. . . . . . . . Good solution. Thanks for posting ... (~Ned Nimfanakon... 17.Oct.12)
. . . . . . . . This looks to be exactly what I am ... (~Laura Asagerok... 17.Dec.13) |
|  |
|